﻿<%
Dim Spot_ID			


Dim Spot_Type
Dim Spot_Area
Dim Spot_City		
Dim Spot_Name
Dim Spot_Desc	

Dim Spot_Pic
Dim Spot_Pic1	
Dim Spot_Pic2	
Dim Spot_Pic3	

Dim Spot_ZY		

Dim Spot_Ticket_Price	
Dim Spot_Open_Time		

Dim Spot_Address		
Dim Spot_Tel		
Dim Spot_Fax		
Dim Spot_Url		

Dim Spot_Traffic		
Dim Spot_Guide		

Dim Spot_Coordinate		


Dim Spot_IsTop		
Dim Spot_IsHide		

Dim Spot_Order		

Dim Spot_ViewCount	
Dim Spot_CommentCount	

Dim Update_Name		
Dim Update_Date		

Dim Add_Msg
Dim Edit_Msg
Dim Del_Msg
Dim Goto_Url

Dim Spot_S_ID		

Dim Spot_S_Name		
Dim Spot_S_Desc		
Dim Spot_S_Order


Dim Spot_City_List_Value
Spot_City_List_Value = "海口,三亚,文昌,琼海,万宁,陵水,五指山,澄迈,定安,屯昌,白沙,琼中,保亭,儋州,乐东,昌江,东方,临高"

Dim Spot_Area_List_Value 
Spot_Area_List_Value = "三亚景点,海口景点,东线景点,中线景点,西线景点"


Add_Msg = "景点增加成功！"
Edit_Msg= "景点修改成功！"
Del_Msg = "景点删除成功！"
Goto_Url= "Spot_Query.asp"

Dim Action


'数据检查
Sub Spot_Data_Check()

	Update_Name			= Session("Admin_UserName")
	Update_Date			= Now()

	Spot_Type = reform("Spot_Type")

	Spot_City = reform("Spot_City")		
	Spot_Area = reform("Spot_Area")		
	Spot_Name = reform("Spot_Name")	

	Spot_Pic  = reform("Spot_Pic")	
	Spot_Pic1 = reform("Spot_Pic1")	
	Spot_Pic2 = reform("Spot_Pic2")	
	Spot_Pic3 = reform("Spot_Pic3")	

	Spot_Zy   = reform("Spot_Zy")	
	Call Check_Length(Spot_Name,100,1,"景点名称")

	Call Check_Length(Spot_Pic,100,0,"景点图片")
	Call Check_Length(Spot_Pic1,100,0,"景点图片")
	Call Check_Length(Spot_Pic2,100,0,"景点图片")
	Call Check_Length(Spot_Pic3,100,0,"景点图片")

	Call Check_Length(Spot_Zy,200,0,"景点摘要介绍")

	Spot_Desc = reform("Spot_Desc")		
	Call Check_Length(Spot_Desc,4000,1,"景点介绍")

	Spot_Ticket_Price = reform("Spot_Ticket_Price")	
	Call Check_IsNumeric_Msg(Spot_Ticket_Price,"景点门票价格")

	Spot_Open_Time	  = reform("Spot_Open_Time")		
	Call Check_Length(Spot_Open_Time,50,0,"景点开放时间")

	Spot_Address = reform("Spot_Address")
	Call Check_Length(Spot_Address,100,0,"景点地址")
	
	Spot_Tel	 = reform("Spot_Tel")	
	Call Check_Length(Spot_Tel,20,0,"景点电话")
	
	Spot_Fax	 = reform("Spot_Fax")		
	Call Check_Length(Spot_Fax,20,0,"景点传真")

	Spot_Url	 = reform("Spot_Url")		
	Call Check_Length(Spot_Url,100,0,"景点网址")

	Spot_Traffic  = reform("Spot_Traffic")
	Call Check_Length(Spot_Traffic,500,0,"景点交通")
	

	Spot_Coordinate = reform("Spot_Coordinate")		
	Call Check_Length(Spot_Coordinate,20,0,"景点地图坐标")


	Spot_IsTop  = reform("Spot_IsTop")	
	Call Check_IsNumeric_Msg(Spot_IsTop,"置项标志")
	
	Spot_IsHide = reform("Spot_IsHide")		
	Call Check_IsNumeric_Msg(Spot_IsHide,"隐藏标志")
End Sub 
Sub Spot_Info_Action()
	Spot_ID = Get_ID("Spot_ID")
	If Spot_ID=0 Then 
		Call Spot_Add()
	Else
		Call Spot_Edit()
	End If 
End Sub 

Sub Spot_Add()	

	Call Spot_Data_Check()

	
	sql = "INSERT INTO Spot_Info( " &_
		"Spot_City"&_
		",Spot_Area"&_
		",Spot_Name"&_
		",Spot_Pic"&_
		",Spot_ZY"&_
		",Spot_Desc"&_

		",Spot_Ticket_Price"&_
		",Spot_Open_Time"&_

		",Spot_Address"&_
		",Spot_Tel"&_
		",Spot_Fax"&_
		",Spot_Url"&_

		",Spot_Traffic"&_

		",Spot_Coordinate"&_


		",Spot_IsTop"&_
		",Spot_IsHide"&_

		",Update_Name"&_
		",Update_Date"&_

		") VALUES( " &_
		"'"&Spot_City&"'"&_
		",'"&Spot_Area&"'"&_
		",'"&Spot_Name&"'"&_
		",'"&Spot_Pic&"'"&_
		",'"&Spot_ZY&"'"&_
		",'"&Spot_Desc&"'"&_
		
		","&Spot_Ticket_Price&_
		",'"&Spot_Open_Time&"'"&_

		",'"&Spot_Address&"'"&_
		",'"&Spot_Tel&"'"&_
		",'"&Spot_Fax&"'"&_
		",'"&Spot_Url&"'"&_

		",'"&Spot_Traffic&"'"&_

		",'"&Spot_Coordinate&"'"&_
		",'"&Spot_IsTop&"'"&_
		",'"&Spot_IsHide&"'"&_

		",'"&Update_Name&"'"&_
		",'"&Update_Date&"'"&_
		")"
    conn.execute(sql)

	AlertBox Add_Msg,Goto_Url


End Sub

Sub Spot_Edit()	

	Spot_ID	= reform("Spot_ID")
	Call Check_IsNumeric_Msg(Spot_ID,"景点ID")


	Call Spot_Data_Check()

	Sql ="UPDATE Spot_Info SET "&_
		" Spot_City = '"&Spot_City&"'"&_
		",Spot_Area = '"&Spot_Area&"'"&_
		",Spot_Name = '"&Spot_Name&"'"&_
		",Spot_Pic = '"&Spot_Pic&"'"&_
		",Spot_ZY = '"&Spot_ZY&"'"&_
		",Spot_Desc = '"&Spot_Desc&"'"&_
		
		",Spot_Ticket_Price = "&Spot_Ticket_Price&_
		",Spot_Open_Time    = '"&Spot_Open_Time&"'"&_

		",Spot_Address      = '"&Spot_Address&"'"&_
		",Spot_Tel			= '"&Spot_Tel&"'"&_
		",Spot_Fax			= '"&Spot_Fax&"'"&_
		",Spot_Url			= '"&Spot_Url&"'"&_

		",Spot_Traffic		= '"&Spot_Traffic&"'"&_

		",Spot_Coordinate	= '"&Spot_Coordinate&"'"&_
		",Spot_IsTop		= '"&Spot_IsTop&"'"&_
		",Spot_IsHide		= '"&Spot_IsHide&"'"&_

		",Update_Name		= '"&Update_Name&"'"&_
		",Update_Date		= '"&Update_Date&"'"&_
		" WHERE Spot_ID="&Spot_ID
    conn.execute(sql)



	AlertBox Edit_Msg,Goto_Url

End Sub

Sub Spot_Del()


	Spot_ID	= Reform("OP_ID")


	Sql = "DELETE FROM  Spot_Info WHERE Spot_ID IN ( "& Spot_ID &")"
    conn.execute(sql)


	AlertBox Del_Msg,Goto_Url
	
End Sub
Function Get_ID(Info_ID)
	If Request.ServerVariables ("Request_Method")="POST" Then
		ID = reform(Info_ID)
	Else
		ID = requery(Info_ID)
	End If 
	If IsNumeric(ID)=False Then 
		Get_ID = 0
	Else
		Get_ID = ID
	End If 
End Function


Sub Get_Spot_Info(ID)

	Info_ID = Get_ID(ID)
	If Info_ID=0 Then 
		Action = "增加"
		Exit Sub 
	End If 

	Spot_ID =requery("Spot_ID")
	Call Check_IsNumeric_Msg(Spot_ID,"景点ID")

	sql = "SELECT * FROM Spot_Info WHERE Spot_ID = " &Spot_ID

	Set rs = conn.execute(sql)
	
	If Not rs.eof Then
		Spot_Area = rs("Spot_Area")		
		Spot_City = rs("Spot_City")		

		
		Spot_Name = rs("Spot_Name")		
		Spot_Pic = rs("Spot_Pic")		
		Spot_ZY = rs("Spot_ZY")		
		Spot_Desc = rs("Spot_Desc")		

		Spot_Ticket_Price = rs("Spot_Ticket_Price")	
		Spot_Open_Time	  = rs("Spot_Open_Time")		

		Spot_Address = rs("Spot_Address")		
		Spot_Tel	 = rs("Spot_Tel")		
		Spot_Fax	 = rs("Spot_Fax")		
		Spot_Url	 = rs("Spot_Url")		

		Spot_Traffic  = rs("Spot_Traffic")		


		Spot_Coordinate = rs("Spot_Coordinate")		

		Spot_IsTop	 = rs("Spot_IsTop")		
		Spot_IsHide	 = rs("Spot_IsHide")		

		Spot_Order		  = rs("Spot_Order")		
		Spot_ViewCount	  = rs("Spot_ViewCount")	
		Spot_CommentCount = rs("Spot_CommentCount")	
		Update_Name		  = rs("Update_Name")		
		Update_Date		  = rs("Update_Date")		

	End If
	
	rs.close
End Sub 

Function Get_Spot_Name(Spot_ID)
	Get_Spot_Name = Get_FirstValue("SELECT Spot_Name FROM Spot_Info WHERE Spot_ID = "&Spot_ID)	
End Function 


Sub Spot_City_List(Spot_City)
	MySelected "Spot_City",Spot_City_List_Value,Spot_City_List_Value,"",Spot_City
End Sub 
Sub Spot_Area_List(Spot_Area)
	MySelected "Spot_Area",Spot_Area_List_Value,Spot_Area_List_Value,"",Spot_Area
End Sub 

%>
